Puppeteer support? · Issue #204 · vercel/pkg · GitHub 您所在的位置:网站首页 puppeteer github Puppeteer support? · Issue #204 · vercel/pkg · GitHub

Puppeteer support? · Issue #204 · vercel/pkg · GitHub

2024-07-17 13:40| 来源: 网络整理| 查看: 265

I'm not sure where to write this but I've found an issue with integrating pkg and puppeteer. The puppeteer API has a method page.evaluate, accepting a function to be executed in the context of the page. This entails serializing the function and passing it over the socket to the Chromium process, to executed there. Implementation wise puppeteer calls toString() on said function.

But since pkg compiles scripts using v8::ScriptCompiler the sources are not kept. This means f.toString() will return something like 'function f() { [native code] }' to be passed over the socket. This will obviously fail with a rather cryptic error message: Error: Evaluation failed: SyntaxError: Unexpected identifier One workaround is to only pass strings to be evaluated as expressions to page.evaluate instead.



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有